package cn.springboot.chapter05.service;

import cn.springboot.chapter05.beans.Book;
import cn.springboot.chapter05.dao.BookDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BookService {
    @Autowired
    private BookDao bookDao;
    public  int addBook(Book book){
        return  bookDao.addBook(book);
    }
    public int updateBook(Book book){
        return  bookDao.updateBook(book);
    }
    public  int deleteBook(Integer id){
        return  bookDao.deleteBook(id);
    }
    public Book getBookById(Integer id){
        return bookDao.getBookById(id);
    }
    public List<Book> getAllBooks(){
        return  bookDao.getAllBooks();
    }
}
